package com.xux.controller;

import com.xux.model.bo.OrderSlicGroupBO;
import com.xux.model.po.OrderSlic;
import com.xux.service.impl.OrderSlicService;
import org.bson.Document;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author: xux
 * @date: 2022-06-30 15:46
 * @version: 1.0
 **/
@RestController
@RequestMapping("/orderSlic")
public class OrderSlicController {

    @Resource
    private OrderSlicService orderSlicService;

    @GetMapping("/findOneById")
    public OrderSlic findOneById(Long id) {
        return orderSlicService.findOneById(id);
    }

    @GetMapping("/testGroup")
    public List<OrderSlicGroupBO> testGroup(String outerId) {
        return orderSlicService.testGroup(outerId);
    }

    @GetMapping("/testGroupDocument")
    public List<Document> testGroupDocument(String outerId) {
        return orderSlicService.testGroupDocument(outerId);
    }

    /**.
     *
     * @description  关联查询
     * @return java.util.List<java.util.Map>
     * @author xux
     * @date 2024-01-30 11:04
     **/
    @GetMapping("/correlationQuery")
    public List<Map> correlationQuery() {
        return orderSlicService.correlationQuery();
    }

    /**.
     *
     * @description  关联查询(带条件)
     * @return java.util.List<java.util.Map>
     * @author xux
     * @date 2024-01-30 11:04
     **/
    @GetMapping("/queryByParams")
    public List<Map> queryByParams(Long teacherId,String jName) {
        return orderSlicService.queryByParams(teacherId,jName);
    }

    /**.
     *
     * @description  对店铺ID分组取最大日期，并根据分组后的结果集，再次从原文档匹配对应记录
     * @author xux
     * @date 2024-02-02 13:57
     **/
    @GetMapping("/groupAndCorrelation")
    public List<Map> groupAndCorrelation() {
        return orderSlicService.groupAndCorrelation();
    }
}
